﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Data.DataGet;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.ComponentModel;

namespace Business.DataBusiness
{
    public class ChiTietHDB
    {
        _ChiTietHDB data = new _ChiTietHDB();
        private string maCTHDB;
        private string maHDB;
        private string maDT;
        private string iMEI;
        private float donGia;

        public string MaCTHDB
        {
            get { return maCTHDB; }
            set { maCTHDB = value; }
        }
       
        public string MaHDB
        {
            get { return maHDB; }
            set { maHDB = value; }
        }
       
        public string MaDT
        {
            get { return maDT; }
            set 
            {
                maDT = value;
                if (maDT == "")
                    throw new Exception("Mã điện thoại đang bán ?");
            }
        }
        public string IMEI
        {
            get { return iMEI; }
            set { iMEI = value; }
        }
        
        public float DonGia
        {
            get { return donGia; }
            set 
            { donGia = value; }
        }
        public ChiTietHDB() { }
        public ChiTietHDB(string maCTHDB1, string MaHDB1, string maDT1, string imei, float donGia1)
        {
            this.MaCTHDB = maCTHDB1;
            this.MaHDB = MaHDB1;
            this.MaDT = maDT1;
            this.IMEI = imei;
            this.DonGia = donGia1;
        }
        public int Insert()
        {
            return data.Insert_ChiTietHDB(this.MaCTHDB,this.MaHDB,this.MaDT,this.IMEI,this.DonGia);
        }
        public int TestIMEI(string iMEI)
        {
            return data.TestIMEI(iMEI).Rows.Count;
        }
    }
}
